#ifndef _NETWORK_SPIDEVMANAGEMENT_SPIDEVMANAGER_H_
#define _NETWORK_SPIDEVMANAGEMENT_SPIDEVMANAGER_H_

#include "Spi_Dev_Management/ISpi_Dev.h"
#include "Spi_Dev_Management/Spi_Buffer_Manager.h"
#include "Maxieye_Spi_Mediator_Contre/Ibuffer_User_Register.h"
#include <vector>
#include <memory>
#include <thread>
#include <future>
#include <atomic>

class IAction;

class Spi_Dev_Manager
{
public:
    Spi_Dev_Manager();
    ~Spi_Dev_Manager();

    bool init(Ibuffer_User_Register* buffer_register);
    bool start();
    void stop();

private:
    void transfer_loop();

    std::unique_ptr<ISpi_Dev>             its_spi_dev;
    std::vector<std::unique_ptr<IAction>> its_loop_actions;
    std::unique_ptr<std::thread>          its_transfer_thread;
    std::promise<bool>                    its_statues_poromise;
    std::future<bool>                     its_statues_future; 
    std::atomic<bool>                     is_running;
};




#endif